package com.xy9860.web.bff.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author xy9860
 * @Description 测试
 * Copyright: Copyright (c) 2020
 * Company: Sichuan haiwujiang information technology Co., Ltd
 * @since 2020/7/2
 */
@RestController
public class ServiceController {

    @Autowired
    private DiscoveryClient discoveryClient;

    @GetMapping("service")
    public List<String> getServiceList(){
        return discoveryClient.getServices();
    }

    @GetMapping("instance")
    public Object getInstance(@RequestParam("name") String name){
        return discoveryClient.getInstances(name);
    }

}